<template>
  <div class="pageNav">
      <div class="pageNav-list" ref="list">
          <div class="pageNav-item" v-for="(item,index) in list" :key="item.id" :class="{active:navIndex === index}">
            {{item.title}}
          </div>
      </div>
  </div>
</template>
<script>
    import {getNavlist} from "api/getNavlist";
    import {mapState} from "vuex";
    export default {
        props: {},
        data() {
            return {
               list:[]
            }
        },
        methods: {
          _getNavlist(){
             this.list = getNavlist();
          },
        },
        computed:{
         ...mapState([
           'navIndex'
         ])
       },
        components: {

        },
        mounted() {

        },
        created() {
           this._getNavlist();
        },
        beforeRouteEnter(to, from, next) {
            next(vm => {

            })
        },
        beforeRouteUpdate(to, from, next) {
            next(vm => {

            })
        },
        beforeRouteLeave(to, from, next) {
            next(vm => {

            })
        },
    }
</script>

<style lang="less" scoped="">
  .pageNav{
    border-bottom: 2px solid #9d2828;
    &-list{

    }
    &-item{
      display: inline-block;
      vertical-align: middle;
      padding: 14px 16px;
      letter-spacing: 2px;
      color: #000;
      background: #f7f7f7;
    }
    .active{
      background: #9d2828;
      color: #fff;
    }
  }
</style>
